1. Field of the Invention
This invention relates to a musical tone-generating method and a musical tone-generating apparatus for generating waveform samples of musical tones through arithmetic operations by the use of a programmable processing unit, such as a CPU (central processing unit) and a DSP (digital signal processor).
2. Prior Art
Conventionally, musical tones have been electronically generated by a tone generator incorporating a processing unit, such as a CPU (central processing unit) or a DSP (digital signal processor), which executes waveform-generating operations to generate waveform samples of musical tones, or by a general-purpose computer, such as a PC (personal computer), which executes a musical tone-generating program to generate musical tones without using special-purpose hardware.
To electronically generate musical tones, it is required to supply waveform samples generated by arithmetic operations to a DAC (digital-to-analog converter) whenever a sampling period elapses, i.e. in synchronism with digital-to-analog conversion timing of the DAC. This requires a very large amount of operation to be executed by the processing unit (hereinafter referred to as "the CPU"). In other words, to generate musical tones, the CPU has to execute processing for preparing musical tone control information and processing for generating waveform samples in response to performance information input thereto, such as MIDI event information.
For example, in the case of a tone generator employing a waveform memory method, the processing for generating waveform samples is executed in the following manner: Based on tone control information prepared from performance information, waveform-determining operations are executed for each tone generation channel by an LFO (Low Frequency Oscillator), a filter EG (envelope generator), a volume EG, etc. Waveform data is read from a waveform memory (waveform table) corresponding to the input performance information, while executing interpolation on the waveform data read from the waveform memory, if required. The resulting waveform data is multiplied by various kinds of EG waveform samples to thereby generate waveform sample data for a specific tone generation channel. These operations are repeatedly carried out for all the tone generation channels, and waveform sample data is accumulated for all the channels to thereby generate waveform data comprised of waveform samples each corresponding to a single sampling time period, i.e. the above-mentioned digital-to-analog conversion timing.
Now, a manner of calculating waveforms by the filter EG or the volume EG will be described with reference to FIGS. 1A to 1C. FIG. 1A shows an example of an envelope divided into four portions: an attack (A) portion, a decay (D) portion, a sustain (S) portion, and a release (R) portion. The level of each of the (A), (D), (S) and (R) portions is expressed by a logarithmic function,. and a musical tone generated based on the logarithmic function is recognized by the human ear as a linear level curve. In the figure, the ordinate represents frequency or amplitude, and the abscissa time. To calculate a value of the level of the envelope (hereinafter referred to as an or the "envelope value(s)") at each sampling time, the following method has been conventionally employed:
FIG. 1B shows an example of method of calculating envelope values on a logarithmic axis. According to this method, data of envelope are stored as logarithmic values, and as depicted in the figure, envelope values are calculated by sequentially adding an amount of change s per one sampling period, such that the calculated adjacent values have equal differences. The envelope values thus calculated and expressed in logarithm are converted to linear values by the use of a predetermined conversion table or by executing arithmetic operations on these values.
FIG. 1C shows another method of calculating envelope values, in which each envelope value obtained at the immediately preceding sampling time is sequentially multiplied by a rate of change a.sup.S per one sampling period to thereby calculate an envelope value at each sampling time. In this method, data of the envelope are not expressed in logarithmic values, but in normal values of amplitude or frequency.
As stated above, the amount of operation executed by the CPU for generating waveform samples of musical tones by arithmetic operations is very large. Further, the amount of operation dynamically varies depending upon the number of channels being used for sounding and the contents of tone-generating operations being executed.
Such a large processing load on the CPU causes the following inconveniences: It is impossible to increase the number of channels which can be used for tone generation. When a software tone generator program (hereinafter referred to as "software tone generator") is executed by a general-purpose computer in parallel with other application programs, the operations of these application programs can be made unstable due to a variation (particularly, an increase) in the amount of operation to be executed by the software tone generator.
Further, the FIG. 1B method calculating envelope values on the logarithmic axis uses addition, and therefore high-speed arithmetic operations can be achieved. However, it requires converting the results of the calculation to linear values, which makes it necessary to provide a conversion table or execute converting operations on the envelope values calculated. The FIG. 1C method uses multiplification which takes a longer time to execute. Although the use of a multiplier can shorten the time for the envelope value calculation, this requires additional provision of hardware, i.e. the multiplier.